package com.cunyu.action.app;

import javax.servlet.http.HttpServletResponse;

import com.cunyu.action.OpenController;
import com.cunyu.bean.Form;
import com.cunyu.util.VcodeUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class AppOpenController extends OpenController {

	@RequestMapping("/gettoken")
	public void getToken(HttpServletResponse res,Form form){
		String token = ""+System.currentTimeMillis();
		VcodeUtil.set(token, "1", 60);
		printOK(res, "", token);
	}

	public boolean checkTokenNoRes(String c_token){
		if("1".equals(VcodeUtil.get(c_token))){
			VcodeUtil.del(c_token);
			return true;
		}
		return false;
	}

}
